/**
 *
 * \file CSingleScreenXServerConnection.cpp
 * \brief This file contains the CSingleScreenXServerConnection class implementation.
 * \author Vladimir Klubkov (aka marked)
 *
 * Last changes date:
 * \date 15.03.2011
 *
 * Copyright 2011 Vladimir Klubkov <marked-one@yandex.ru>
 *
 * This file is part of OOXlib.
 *
 * OOXLib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * OOXlib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OOXlib; if not, you can try to find  it here:
 * http://www.gnu.org/licenses/gpl.txt
 * or write to the Free Software Foundation, Inc., 59 Temple Place,
 * Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "../include/CSingleScreenXServerConnection.h"

namespace OOXlib {

/**
 * Constructor. Calls the base-class constructor. See CXServerConnection for more information.
 */
CSingleScreenXServerConnection::CSingleScreenXServerConnection() : CXServerConnection() {}
/**
 * Constructor.Calls the base-class constructor. See CXServerConnection for more information.
 * \param DisplayName Input parameter, a string contatining the display name. Might be empty.
 */
CSingleScreenXServerConnection::CSingleScreenXServerConnection(const ::std::string &DisplayName)
: CXServerConnection(DisplayName) {
    if(0 < m_iScreensCount) {
        // If screens count is greater than nil, we hardcode it to 1.
        m_iScreensCount = 1;
    }
}
/**
 * Returns the screens count.
 * \return Screens count.
 */
int CSingleScreenXServerConnection::GetScreensCount() const {
    return m_iScreensCount;
}
/**
 * Checks the screen number for validity. To be valid, it must be lower than the screens count and greater or equal than nil.
 * \param iScreenNumber Number of the screen to check.
 * \return True, if the number is valid, else - false.
 */
bool CSingleScreenXServerConnection::IsScreenNumberValid(const int iScreenNumber) const {
// \todo (marked#1#): Is this valid? Haven't found any description how to check the screen number for validity.
    if(0u == m_iScreensCount) {
        return false;
    }
    if(0 > iScreenNumber) {
        return false;
    }
    if(0 == iScreenNumber) {
        return false;
    }
    return true;
}

} // OOXlib
